#include "stdafx.h"
#include "textTokens.h"

CTokenStream::CTokenStream( const std::vector< CToken >& tokens )
	: m_tokens( &tokens )
	, m_current( 0 )
{
}

void CTokenStream::Reset()
{
	m_current = 0;
}

const CToken* CTokenStream::Get()
{
	static CToken EMPTY;

	if ( m_current >= (int) m_tokens->size() )
		return &EMPTY;

	return &(*m_tokens)[ m_current++ ];
}

const CToken* CTokenStream::Peek()
{
	static CToken EMPTY;

	if ( m_current >= (int) m_tokens->size() )
		return &EMPTY;

	return &(*m_tokens)[ m_current ];
}

const bool CTokenStream::End() const
{
	return m_current >= (int)m_tokens->size();
}